<!DOCTYPE html>
<html>
<head>
	<title>版本管理</title>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
	<link rel="stylesheet" href="../../css/bootstrap.min.css">
	<link rel="stylesheet" href="../../css/font-awesome.min.css">
	<link rel="stylesheet" href="../../plugins/jqgrid/ui.jqgrid-bootstrap.css">
	<link rel="stylesheet" href="../../plugins/ztree/css/metroStyle/metroStyle.css">
	<link rel="stylesheet" href="../../css/main.css">
	<!-- validate css -->
	<link href="../../plugins/validate/validate.css" rel="stylesheet" type="text/css" />
	<script src="../../libs/jquery.min.js"></script>
	<script src="../../plugins/layer/layer.js"></script>
	<script src="../../libs/bootstrap.min.js"></script>
	<script src="../../libs/vue.min.js"></script>
	<script src="../../plugins/jqgrid/grid.locale-cn.js"></script>
	<script src="../../plugins/jqgrid/jquery.jqGrid.min.js"></script>
	<script src="../../plugins/ztree/jquery.ztree.all.min.js"></script>
	<script src="../../js/common.js"></script>
</head>
<body>
<div class="container-fluid" id="rrapp"  v-cloak width="100%" >
	<div v-show="showList" class="content-box">
		<div class="grid-btn">
			<table>
				<tr>
					<td>
						<div class="form-group col-xs-4 col-md-2 col-lg-2">
							<input type="text"
								   class="form-control"
								   size="30"
								   v-model.lazy="q.lastVersion"
								   @keyup.enter="query"
								   placeholder="当前版本号">

						</div>
						<div class="form-group col-xs-4 col-md-2 col-lg-2">
							<select  class="form-control" name="os" v-model.lazy="q.os">
								<option value="" selected="selected">手机系统</option>
								<option value="android" >android</option>
								<option value="ios">ios</option>
							</select>
						</div>
						<div class="form-group col-xs-4 col-md-2 col-lg-2">
							<select  class="form-control" name="sts" v-model.lazy="q.sts">
								<option value="" selected="selected">状态</option>
								<option value="0" >在用版本</option>
								<option value="1">历史版本</option>
							</select>
						</div>
						<a  class="btn btn-default  col-xs-2 col-md-1 col-lg-1" @click="query">查询</a>
						<a v-if="hasPermission('sys:getVersions:save')" class="btn btn-primary  col-xs-2 col-md-1 col-lg-1" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
						<a v-if="hasPermission('sys:getVersions:update')" class="btn btn-primary  col-xs-2 col-md-1 col-lg-1" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
						<a v-if="hasPermission('sys:getVersions:delete')" class="btn btn-primary  col-xs-2 col-md-2 col-lg-1" @click="del">更改版本</a>
					</td>
				</tr>
			</table>
		</div>
		<table id="jqGrid"></table>
		<div id="jqGridPager"></div>
	</div>

	<div v-show="!showList" class="panel panel-default" style="height:1134px">
		<div class="panel-heading">{{title}}</div>
		<form class="form-horizontal" id="versionManage" >
			<div class="form-group">
				<div class="col-sm-2 control-label">最新版本号</div>
				<div class="col-sm-10">
					<input type="text"
						   id="lastVersion"
						   name="lastVersion"
						   class="form-control"
                           @blur="getVersionDate"
						   v-model.trim="getversions.lastVersion"
						   placeholder="最新版本号"/>
				</div>
			</div>
            <div class="form-group">
                <div class="col-sm-10">
                    <input type="hidden"
                           id="versionDate"
                           name="versionDate"
                           class="form-control"
                           v-model.trim="getversions.versionDate"
                           placeholder="版本日期"/>
                </div>
            </div>
			<div class="form-group">
				<div class="col-sm-2 control-label">软件包大小</div>
				<div class="input-group col-sm-8">
					<input type="text"
                           id="size"
                           name="size"
                           class="form-control"
                           aria-describedby="basic-addon2"
                           type="number"
                           v-model.number="getversions.size"
                           @blur="clear()"
                           placeholder="软件包大小"/>
					<span class="input-group-addon" id="basic-addon2">MB</span>
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-2 control-label">手机系统</div>
				<div class="col-sm-10">
					<select  class="form-control" name="os" v-model.lazy="getversions.os">
						<option value="android" selected="android">android</option>
						<option value="ios">ios</option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-2 control-label">更新日志-中文</div>
				<div class="col-sm-10">
					<textarea wrap="physical"
							  class="form-control"
							  id="changeLogZh"
							  name="changeLogZh"
							  rows="6"
							  v-model.trim="getversions.changeLogZh"
							  placeholder="更新日志写在这里"></textarea>
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-2 control-label">更新日志-英文</div>
				<div class="col-sm-10">
					<textarea wrap="physical"
							  class="form-control"
							  id="changeLogEn"
							  name="changeLogEn"
							  rows="6"
							  v-model.trim="getversions.changeLogEn"
							  placeholder="updateLog in English write here"></textarea>
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-2 control-label">是否强制更新</div>
				<div class="col-sm-10">
					<label class="radio-inline">
						<input type="radio" name="isForceUpdating"value="0" v-model.lazy="getversions.isForceUpdating" > 是
					</label>
					<label class="radio-inline">
						<input type="radio"  name="isForceUpdating" v-model.lazy="getversions.isForceUpdating" value="1" checked> 否
					</label>
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-2 control-label">使用状态</div>
				<div class="col-sm-10">
					<label class="radio-inline">
						<input type="radio" name="sts"value="0" v-model.lazy="getversions.sts"checked>在用版本
					</label>
					<label class="radio-inline">
						<input type="radio"  name="sts" v-model.lazy="getversions.sts" value="1"> 历史版本
					</label>
				</div>
			</div>
		</form>
		<div class="form-group">
			<div class="col-sm-2 control-label"></div>
			<input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>
			&nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
		</div>
	</div>
</div>

<script src="../../js/modules/sys/config.js"></script>
<!-- validate js -->
<script	src="../../plugins/validate/jquery.validate.min.js"></script>
<script	src="../../plugins/validate/jquery.validate.extend.js"></script>
<script src="../../plugins/validate/messages_bs_zh.js"></script>
<script type="text/javascript">
jQuery(function($){
		formValidate();
	});

		function formValidate() {
			$("#versionManage").validate({
				onfocusout : function(addacc) {
					$(addacc).valid();
				},
				rules : {
					lastVersion : {
						required : true,
						isMatched:true,
					},
					size:{
						required:true,
						isNumber:true,
					},
					changeLogZh:{
						required:true
					},
					changeLogEn:{
						required:true
					},
				},
			});
		}
		function checkIsExists(id,msg){
			 var processId = "#"+id;
			 $(processId).after("<span>" +msg+"</span>");
		}

		function removeObject(id){
			var processId = "#"+id;
			$(processId).next().remove();
		}
		function clear(){
		var size=$("#size").val();
		if ((/^(\d+\.\d{1,2}|[1-9][0-9]*)$/).test(size)) {
	    }else{
	        $("#size").val("");
	    }
		}
</script>
</body>
</html>